{% include "data/template-ui.html" %}
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'css/icons.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/fonts.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/sweetalert.css' %}" />

<style>
    .container-fluid {
        padding: 0 10 0;
    }

    .page-wrapper {
        padding-bottom: 20px;
    }

    .page-wrapper {
        min-height: 600px !important;
    }

    .btn-refresh {
        background-color: #c53727;
        color: #fff;
    }

    .btn-check {
        background-color: #35aa47;
        color: #fff;
    }
</style>

<div class="page-wrapper">
    <!-- 正文 -->
    <div class="container-fluid animated fadeInUp">
        <div class="col-12">
            <div class="card">
                <div class="card-title">
                    <h4 class="text-primary">更新数据质量检核结果-季度：{{ quarter }}</h4>
                    <h5 class="card-subtitle">注：需要对全7家公司完成检核才会在仪表盘、检核报告中显示新的季度数据</h5>
                </div>

                <div class="card-content">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>公司</th>
                                <th>检核进度</th>
                                <th>刷新进度</th>
                                <th>检核规则</th>
                                <th>#操作</th>
                            </tr>
                        </thead>

                        <tbody>
                            <!-- 信托公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>信托公司</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar wow animated progress-animated"
                                            style="width: {{ progressbar_ycxt }}%; height:6px;background-color:#2ec7c9;"
                                            role="progressbar"> </div>
                                    </div>
                                    <small>{{ progressbar_ycxt }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()"><i
                                            class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新</button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=信托&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a>
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="ycxt"
                                        onclick="rule_execute('ycxt')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                </td>
                            </tr>

                            <!-- 资产公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>资产公司</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar wow animated progress-animated"
                                            style="width: {{ progressbar_yczc }}%; height:6px;background-color:#b6a2de;"
                                            role="progressbar"> </div>
                                    </div>
                                    <small>{{ progressbar_yczc }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()"><i
                                            class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新</button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=资产&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a>
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="yczc"
                                        onclick="rule_execute('yczc')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                </td>
                            </tr>

                            <!-- 再担保公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>担保公司</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar wow animated progress-animated"
                                            style="width: {{ progressbar_gdzdb }}%; height:6px;background-color:#dc69aa;"
                                            role="progressbar"> </div>
                                    </div>
                                    <small>{{ progressbar_gdzdb }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()">
                                        <i class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新
                                    </button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=广东再担保&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a>
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="gdzdb"
                                        onclick="rule_execute('gdzdb')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                </td>
                            </tr>

                            <!-- 金科公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>金科公司</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar wow animated progress-animated"
                                            style="width: {{ progressbar_ycjk }}%; height:6px;background-color:#7eb00a;"
                                            role="progressbar"> </div>
                                    </div>
                                    <small>{{ progressbar_ycjk }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()">
                                        <i class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新
                                    </button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=信托&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a> </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="ycjk"
                                        onclick="rule_execute('ycjk')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                </td>
                            </tr>

                            <!-- 基金创投公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>基金创投</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar wow animated progress-animated"
                                            style="width: {{ progressbar_fdct }}%; height:6px;background-color:#c14089;"
                                            role="progressbar"> </div>
                                    </div>
                                    <small>{{ progressbar_fdct }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()">
                                        <i class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新
                                    </button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=基金创投&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a>
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="fdct"
                                        onclick="rule_execute('fdct')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                </td>
                            </tr>

                            <!-- 中银粤财公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>中银粤财</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar wow animated progress-animated"
                                            style="width: {{ progressbar_zyyc }}%; height:6px;" role="progressbar">
                                        </div>
                                    </div>
                                    <small>{{ progressbar_zyyc }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()">
                                        <i class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新
                                    </button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=中银&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a>
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="zyyc"
                                        onclick="rule_execute('zyyc')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                    </a>
                                </td>
                            </tr>

                            <!-- 金租公司 -->
                            <tr>
                                <td>#</td>
                                <td>
                                    <a>金租公司</a>
                                </td>
                                <td class="project_progress">
                                    <div class="progress">
                                        <div class="progress-bar bg-warning wow animated progress-animated"
                                            style="width: {{ progressbar_jz }}%; height:6px;" role="progressbar"> </div>
                                    </div>
                                    <small>{{ progressbar_jz }}% 已完成</small>
                                </td>
                                <td>
                                    <button href="javascript:void(0);" class="btn btn-xs btn-refresh"
                                        onclick="fun_refresh()">
                                        <i class="im-spinner2 fa-spin"></i>&nbsp;&nbsp;点击刷新
                                    </button>
                                </td>
                                <td>
                                    <a href="../check/rule_list?name=金租&risk_market=" target="_blank"
                                        class="btn btn-primary btn-xs">
                                        <i class="im-link"></i>&nbsp;&nbsp;查看规则
                                    </a>
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="btn btn-xs btn-check" id="jz"
                                        onclick="rule_execute('jz')">
                                        <i class="im-paperplane"></i>&nbsp;&nbsp;立即检核>>
                                    </a>
                                </td>
                            </tr>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<footer class="navbar-fixed-bottom" style="line-height: 10px;font-size:13px;">
    <div class="footer">
        © 2019 Hyhyhyhyhyhyh
    </div>
</footer>

<!-- Jquery -->
<script src="{% static 'js/lib/jquery/jquery.min.js' %}"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="{% static 'js/lib/bootstrap/js/popper.min.js' %}"></script>
<script src="{% static 'js/lib/bootstrap/js/bootstrap.min.js' %}"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="{% static 'js/jquery.slimscroll.js' %}"></script>
<!--Menu sidebar -->
<script src="{% static 'js/sidebarmenu.js' %}"></script>
<!--stickey kit -->
<script src="{% static 'js/lib/sticky-kit-master/dist/sticky-kit.min.js' %}"></script>
<script src="{% static 'js/custom.min.js' %}"></script>
<script src="{% static 'js/sweetalert.min.js' %}"></script>

<script>
    function rule_execute(val) {
        swal("开始执行检核，可以点击检核状态刷新进度");
        document.getElementById(val).disabled = true;

        //更新数据库
        $.ajax({
            type: "POST",
            url: "rule_execute",
            data: {
                company: val,
                username: "{{ username }}",
                quarter: "{{ quarter }}",
            },
            success: function (data) {
                //console.log(data);
                if (data.status == 'success') {
                    document.getElementById(val).disabled = false;

                    swal({
                        title: data.msg,
                        icon: "success",
                    });
                }
                else {
                    swal('发生错误!', data.status, 'error');
                    document.getElementById(val).disabled = false;
                }
            },
            error: function (e) {
                swal('发生错误!', data.status, 'error');
                document.getElementById(val).disabled = false;
            }
        })
    };

    function fun_refresh() {
        location.replace(location);
    };
</script>

</body>

</html>